import Vue from 'vue'
import App from './App.vue'
import router from './router';
import * as echarts from 'echarts';
import dataV from '@jiaminghi/data-view'
import Axios from "axios";
import qs from "qs";
import "element-ui/lib/theme-chalk/index.css";
import ElementUI from "element-ui";

Vue.use(dataV)
Vue.use(ElementUI)

Vue.prototype.$echarts = echarts;
Vue.prototype.$axios = Axios;
Vue.prototype.$qs = qs;

if (process.env.NODE_ENV === "development") {
  // 本地调试
  Axios.defaults.baseURL = "http://39.103.167.53:9278";
  // Axios.defaults.baseURL = 'http://192.168.1.107:9278/';
} else if (process.env.NODE_ENV === 'production') {
  // 线上发布
  Axios.defaults.baseURL = "http://39.103.167.53:9278";
}

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')

function setRem() {
  // console.log('zishiy')
  var whdef = 100 / 1920; // 表示1920的设计图,使用100PX的默认值
  var bodyWidth = document.body.clientWidth; // 当前窗口的宽度
  if (bodyWidth < 1000) { //设置最小宽度
    bodyWidth = 1000
  }
  var rem = bodyWidth * whdef; // 以默认比例值乘以当前窗口宽度,得到该宽度下的相应FONT-SIZE值
  document.getElementsByTagName('html')[0].style.fontSize = rem + 'px';
}
window.addEventListener('load', setRem);
window.addEventListener('resize', setRem);